package com.criticalritrpg;



import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TimePicker;


public class AgendaActivity extends Activity {
	
	//private int dia,mes,ano;
	private EditText ed;
	private DatePicker date;
	private TimePicker  horas;
	private Button b;
	public static String HORA = "hora";
	public static String MIN = "min";
	public static String DIA = "dia";
	public static String MES = "mes";
	public static String ANO = "ano";
	public static String LOCAL = "local";
	
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.agendamento);
		
		ed = (EditText) findViewById(R.id.editText1);
		b = (Button) findViewById(R.id.button1);
		date = (DatePicker) findViewById(R.id.datePicker1);
		horas = (TimePicker) findViewById(R.id.timePicker1);
		
		b.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
		        intent.putExtra(HORA, horas.getCurrentHour());
		        intent.putExtra(MIN, horas.getCurrentMinute());
		        
		        intent.putExtra(DIA, date.getDayOfMonth());
		        intent.putExtra(MES, date.getMonth());
		        intent.putExtra(ANO, date.getYear());
		        
		        intent.putExtra(LOCAL, ed.getText().toString());
		        
		        setResult(Activity.RESULT_OK, intent);
		        finish();
		        
		        
		        
			}
		});
		
		
		
    }
    
    
}